﻿<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width,height=device-height, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0,shrink-to-fit=no" />
<meta name="format-detection" content="telephone=no" />
<!--em标准js代码，请放在页面的最上方，前面最好不要再有JS代码或JS文件-->
<script type="text/javascript" src="/js/rem.js"></script>
<link type="text/css" rel="stylesheet" href="/css/css.css" />
<link type="text/css" rel="stylesheet" href="/css/style.css" />
<title>东易日盛装饰开业盛典</title>
</head>

<body>		
	
	<div class="header">
		<a href="javascript:history.go(-1)" class="backa"></a>

		<a href="/plan/planAdd" class="adda"></a>
	</div>	

	<div class="main main2" style="margin-top: 7vh">
		<div class="wp1">
			<div class="wp2" style="height: 11.5rem">

				<div class="t1">施工计划详情</div>
				
				<div class="p7_in">
					<div class="ti">合同编号</div>
					<input id="conCode" name="conCode" type="text" class="text" disabled>
				</div>

				<div class="p7_in">
					<div class="ti">签约时间</div>
					<div class="mh_time">
						<input type="date" class="text" disabled>
						<span id="conTime" name="conTime" class="mh_val"></span>
					</div>
				</div>

				<div class="p7_in">
					<div class="ti">客户姓名</div>
					<input id="userName" name="userName" type="text" class="text" disabled>
				</div>

				<div class="p7_in">
					<div class="ti">客户住址</div>
					<input id="address" name="address" type="text" class="text" disabled>
				</div>

				<div class="p7_in">
					<div class="ti">项目经理</div>
					<input id="manager" name="manager" type="text" class="text">
				</div>

				<div class="p7_in">
					<div class="ti">计划开工时间</div>
					<div class="mh_time">
						<input id="startTime" name="startTime" type="date" class="text">
						<span id="startTime1" name="startTime1" class="mh_val"></span>
					</div>
				</div>

				<div class="p7_in">
					<div class="ti">计划完工时间</div>
					<div class="mh_time">
						<input id="endTime" name="endTime" type="date" class="text">
						<span id="endTime1" name="endTime1" class="mh_val"></span>
					</div>
				</div>

				<div class="p7_in">
					<div class="ti">专属设计师</div>
					<input id="desId" name="desId" type="text" class="text" disabled>
				</div>

				<div class="p7_in">
					<div class="ti">备注</div>
					<input id="remark" name="remark" type="text" class="textremark">
				</div>
				<input type="hidden" id="planId" name="planId"><br>
				<span id="msg" class="p3_inp" style="color: red;text-align: center;border: none;"></span>


				<a href="javascript:;" class="go" id="bmBtn" onclick="submit();">确认</a>

			</div>
		</div>
	</div>

	<img src="/images/bodysd.jpg" alt="" class="sd">
</body>
<script type="text/javascript" src="/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/js/base.js"></script>
<script type="text/javascript" src="/js/popups.js"></script>
<script type="text/javascript">

	$(function () {
		getPlanDetail();
	});

	function getPlanDetail() {
		$.ajax({
			url: "/plan/planDetail",
			method: "get",
			data: "",
			success: function (data) {
				$.ajax({
					url:"/contract/getContractByCode",
					method: "post",
					data: {
						conCode:data.conCode
					},
					success: function (data){
						$("#userName").val(data.contract.userName)
					}
				})
				$("#planId").val(data.planId)
				$("#conCode").val(data.conCode)
				$("#conTime").text(data.conTime)
				$("#address").val(data.address)
				$("#manager").val(data.manager)
				$("#startTime1").text(data.startTime)
				$("#endTime1").text(data.endTime)
				$("#desId").val(data.desId)
				$("#remark").val(data.remark)
			}
		})
	}



	function submit() {
		var flag=true;
		var planId=$("#planId").val();
		var conCode=$("#conCode").val();
		var conTime=$("#conTime").text();
		var userName=$("#userName").val();
		var address=$("#address").val();
		var manager=$("#manager").val();
		var startTime=$("#startTime1").text();
		var endTime=$("#endTime1").text();
		var desId=$("#desId").val();
		var remark=$("#remark").val();

		//非空验证
		if (!checkEndTime(endTime)){flag=false;}
		if (!checkStartTime(startTime)){flag=false;}
		if (!checkManager(manager)){flag=false;}
		if (!checkConCode(conCode)){flag=false;}

		if(flag){
			$.ajax({
				url:"/plan/planModify",
				method:"post",
				data:{
					planId:planId,
					conCode:conCode,
					conTime:conTime,
					userName:userName,
					address:address,
					manager:manager,
					startTime:startTime,
					endTime:endTime,
					desId:desId,
					remark:remark,
				},
				success:function (data) {
					if(data>0){
						jqtoast("修改成功");
						setTimeout(function () {
							location.href="/plan"
						},2000)
					}
				}
			})
		} else {
			return ;
		}
	}

	//非空验证
	function checkConCode(conCode) {
		if(conCode==""){
			$("#msg").text("合同编号不为空");
			return false;
		} else {
			return true;
		}
	}

	function checkManager(manager) {
		if(manager==""){
			$("#msg").text("项目经理不为空");
			return false;
		} else {
			return true;
		}
	}

	function checkStartTime(startTime) {
		if(startTime==""){
			$("#msg").text("开工时间不为空");
			return false;
		} else {
			return true;
		}
	}

	function checkEndTime(endTime) {
		if(endTime==""){
			$("#msg").text("完工时间不为空");
			return false;
		} else {
			return true;
		}
	}
</script>
</html>